package com.imay.live.activity.load;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;

import com.imay.base.helper.ActivityHelper;
import com.imay.live.activity.MainActivity2;
import com.imay.live.helper.H5Helper;
import com.imay.live.helper.ShareSDKHelper;

/**
 * Created by Administrator on 2017/8/18 0018.
 */

public class WebCallBackActivity extends Activity {

    public static final String WEB_KEY = "web_key";

    public static void start(Context context) {
        Intent starter = new Intent(context, StartActivity.class);
        context.startActivity(starter);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        String fromurl = ShareSDKHelper.getDataUrl(getIntent());
        /**
         * 后台有界面情况下，H5直接在Activity栈中最后一个界面跳
         * 安卓按home键之后，再次点击程序图标避免再次重新启动程序解决办法
         */
        if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) {
            if (H5Helper.startActivity(fromurl)) {
                finish();
                return;
            }
        }

        MainActivity2.startActivity(this, fromurl);
        finish();
    }
}